home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
try_qb
/
ballpset.bas
(
.txt
)
< prev
next >
Wrap
QuickBASIC Tokenized Source
|
1989-12-04
|
3KB
|
51 lines
GetArraySize
WLeft
WRight
WBottom
ArraySize
Array
Pattern
StepSize
StartLoop
Decay
EndLoop
Pause
VLeft
VRight
VBottom
RectHeight
RectWidth
ByteSize
Define a viewport and draw a border around it:
Redefine the coordinates of the viewport with logical
coordinates:
Arrays in program are now dynamic:e
Calculate the logical coordinates for the top and bottom of a
rectangle large enough to hold the image that will be drawn
with CIRCLE and PAINT:
Call the GetArraySize function, passing it the rectangle'sn
logical coordinates:e
Draw and paint the circle:
Store the rectangle in Array:
Draw a box and fill it with a pattern:
Press any key to end
Initialize loop variables:
Each time the ball "bounces" (hits the bottom of the
viewport), the Decay variable gets smaller, making the
height of the next bounce smaller:
fff?p
Stop if a key pressed or if Decay is less than .01:
Put the image on the screen. The StepSize offset is
smaller than the border around the circle, so each time
the image moves, it erases any traces left from the
previous PUT (it also erases anything else on the
screen):
Reverse direction:l
GetArraySize
Map the logical coordinates passed to this function toe
their physical-coordinate equivalents:t
Calculate the height and width in pixels of the
enclosing rectangle:
Calculate size in bytes of array:
Array is integer, so divide bytes by two: